﻿// -----------------------------------------------------------------------
// <copyright file="MetalGroupBox.cs" company="Abyssalsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Metal.Config.ExtendedControls
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Windows.Forms;

    /// <summary>
    /// Custom GroupBox
    /// </summary>
    public class MetalGroupBox : System.Windows.Forms.GroupBox
    {
        /// <summary>Stores the resource ID</summary>
        private string strResourceID;

        /// <summary>
        /// Gets or sets the resource ID
        /// </summary>
        public string ResourceID
        {
            get
            {
                return this.strResourceID;
            }

            set
            {
                this.strResourceID = value;
            }
        }

        /// <summary>
        /// When the control becomes visible load the control value (checked / unchecked) and the text (resource)
        /// </summary>
        /// <param name="e">Event args</param>
        protected override void OnVisibleChanged(EventArgs e)
        {
            base.OnVisibleChanged(e);

            if (!this.DesignMode)
            {
                this.Text = Resources.MessageProvider.GetMessage(this.ResourceID);
            }
        }
    }
}
